﻿<%@ Page Language="C#"  MasterPageFile="~/Default.Master" AutoEventWireup="true" Title="Edit My Location" CodeBehind="EditLocation.aspx.cs" Inherits="Kiosk.WebManagement.EditLocation"  %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" language="javascript">
        function setMarkerLocation(x,y)
        {
            var marker = document.getElementById('<%= marker.ClientID %>');
            var imgPos = getPos(document.getElementById('<%= ImageButton1.ClientID  %>'));
            
            window.onresize = function()
            {
                setMarkerLocation(x,y,'<%= ImageButton1.ClientID  %>');
            }
            // the -10 comes to center the image on the point we clicked
            marker.style.left = x - 10 + imgPos[0] + 'px';
            marker.style.top = y - 10 + imgPos[1] + 'px'
        }
        
        function getPos(theElement)
        {
          var positionX = 0;
          var positionY = 0;
          while (theElement != null)
          {
            positionX += theElement.offsetLeft;
            positionY += theElement.offsetTop;
            theElement = theElement.offsetParent;
          }
          return [positionX, positionY];
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <asp:Label ID="lblNotUser" runat="server" Text="You are not a valid user and will not be able to edit your location" 
    style="background-color:#FF9999; border: dashed 2px red; margin:25px; display:block;" Visible="false">
    </asp:Label>
    <div id="marker" runat="server" style="position:absolute; top:500px;left:400px;">
        <img alt="You!" src="images/marker.png" />
        <br />
        <span style="border: solid 1px black; background:white; color:Black; padding:2px;">Your Current Location</span>
    </div>
    <div class="TopContent">&nbsp;</div>
    <div class="MiddleContent">
        <p style="margin:0px 0px 0px 50px;">
                        Please click on the map to update your location.
        </p>

    </div>
    <div class="BottomContent">&nbsp;</div>
    <br />
    <div  style="text-align:center;">
        <asp:ImageButton ID="ImageButton1" runat="server" 
            ImageUrl="~/images/styledMAP.png" onclick="ImageButton1_Click"  />
    </div>
</asp:Content>
